/*
 * Vector.h
 * Represents a vector in the 3-dimensional space.
 *
 */
#ifndef _VECTOR_H_
#define _VECTOR_H_

#include <ostream>

#include "Real.h"

class Vector
{

public:
	Vector();
	Vector(const Vector &v);
	Vector(const Real &x);
	Vector(const double &x);
	Vector(const Real &x, const Real &y);
	Vector(const double &x, const double &y);
	Vector(const Real &x, const Real &y, const Real &z);
	Vector(const double &x, const double &y, const double &z);

	inline Real getX() const;
	inline Real getY() const;
	inline Real getZ() const;

	Vector operator+(const Vector &v) const;
	Vector operator-(const Vector &v) const;
	Vector operator*(const Real &aReal) const;

	bool operator==(const Vector &v) const;

	friend std::ostream &operator<<(std::ostream &out, const Vector &v);

	Real norm2() const;
	Vector dotProduct(const Vector &v) const;

private:

	static const unsigned int X_INDEX;
	static const unsigned int Y_INDEX;
	static const unsigned int Z_INDEX;

	static const unsigned int COORDINATES_COUNT = 3;

	Real coordinates[Vector::COORDINATES_COUNT];

	void initialize(const Real &x, const Real &y, const Real &z);
};

Vector operator*(const Real &aReal, const Vector &v);

#endif /* _VECTOR_H_ */